﻿using System;
using System.Collections.Generic;
using System.Text;
using FunctionalCLR.Core;

namespace FunctionalCLR.Core.Function.List {

    /// <summary>
    /// echo(memberof(2, [1,2,3]));
    /// 
    /// the expected result is true
    /// </summary>
    public class ListMemberOfNode : FuncNode {

        public ListMemberOfNode()
            : base() {
            this.Value = "memberof";
        }

        public override FuncNode GetReversedFunction(int index) {
            throw new NotImplementedException();
        }

        public override object Evaluate() {
            if (!Children[0].GetType().Equals(typeof(ListNode))) {
                throw new Exception();
            }

            return Children.Count;
        }
    }
}
